EX_IDM    = ../test/ex_idm.sh
#PROFILER  = python -m cProfile 
PROFILER  = time
TRAIN_EXE = ./serial_som.py

# Correctness test params
C_DIM       = 10
C_TS_SIZE   = 10000
C_TDATA     = ~/mas/project/train_data/idm/id10_1000.dat
C_SIZE_X    = 100
C_SIZE_Y    = 100
C_SOM_INI   = c_som_ini.dat
C_SOM_FIN   = c_som_fin.dat
C_SHOW_PROG = 100
C_TEST_OUT  = c_test.out

# Performance test params
P_DIM       = 1000
P_TS_SIZE   = 100
P_TDATA     = ../../train_data/idm/id1000_1.dat
P_SIZE_X    = 140
P_SIZE_Y    = 140
P_SOM_INI   = p_som_ini.dat
P_SOM_FIN   = p_som_fin.dat
P_SHOW_PROG = 1
P_TEST_OUT  = p_test.out

MIN_W     = 0
MAX_W     = 1
DEBUG     = 1

all: compile

compile:
	python compile.py build_ext --inplace

testc: $(TRAIN_EXE)
	$(PROFILER) $(TRAIN_EXE) $(C_DIM) $(C_TS_SIZE) $(C_TDATA) $(C_SIZE_X) $(C_SIZE_Y) $(MIN_W) $(MAX_W) $(C_SOM_INI) $(C_SOM_FIN) $(DEBUG) $(C_SHOW_PROG) > $(C_TEST_OUT) 2>&1
		$(EX_IDM) $(C_SOM_FIN) >> $(C_TEST_OUT)
	tail -$(C_DIM) $(C_TEST_OUT)

testp: $(TRAIN_EXE)
	 $(PROFILER) $(TRAIN_EXE) $(P_DIM) $(P_TS_SIZE) $(P_TDATA) $(P_SIZE_X) $(P_SIZE_Y) $(MIN_W) $(MAX_W) $(P_SOM_INI) $(P_SOM_FIN) $(DEBUG) $(P_SHOW_PROG) > $(P_TEST_OUT) 2>&1

clean:
	rm -fr nohup.out *.pyc ./build *.so *.c __pycache__
	rm -f $(C_SOM_INI) $(C_SOM_FIN) $(P_SOM_INI) $(P_SOM_FIN)
	rm -f $(C_TEST_OUT) $(P_TEST_OUT)
